<script lang="ts" setup>
import { computed, render } from 'vue';
import { DeviceServiceDetailResult, DeviceStatusServiceStatusListResult } from '../interface';
import { divide } from 'lodash-es';

interface Idevice {
    dj: boolean[],
    mcs: boolean[],
    va_temperature: number
    va_humidity: number

}

const p = defineProps<{ device: Idevice }>()

</script>

<template>
    <div class="list">
        <div class="list-item">
            <div class="list-item-div">
                亮灯：
            </div>
            <div class="list-item-1">
                {{ device.dj.filter(e => e).length }} 开
                {{ device.dj.filter(e => !e).length }} 关
            </div>
        </div>
        <div class="list-item">
            <div class="list-item-div">
                窗户：
            </div>
            <div class="list-item-1">
                {{ device.mcs.filter(e => e).length }} 开
                {{ device.mcs.filter(e => !e).length }} 关
            </div>
        </div>
        <div class="list-item">
            <div class="list-item-div">
                温度：
            </div>
            <div class="list-item-1">
                {{ device.va_temperature }}
                <span v-if="device.va_temperature < 20">较冷</span>
                <span v-else-if="device.va_temperature <= 28">适中</span>
                <span v-if="device.va_temperature > 28">较热</span>
            </div>
        </div>
        <div class="list-item">
            <div class="list-item-div">
                湿度：
            </div>
            <div class="list-item-1">
                {{ device.va_humidity }} 适中
            </div>
        </div>
        <div class="list-item">
            <div class="list-item-div">
                本月电量：
            </div>
            <div class="list-item-1">
                24度
            </div>
        </div>
    </div>
</template>

<style scoped>
.list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0px 0px 24px;
    width: 478px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 5px 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(60px);
    border-radius: 12px;
    margin-bottom: 12px;
}


.list-title {
    height: 48px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px 24px;
}

.list-item {
    padding: 12px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 72px;
    background: var(--el-menu-bg-color);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.list-item-div {
    width: 280px;
}

.list-item-1 {
    width: 150px;
    text-align: right;
}

.bottom-1 {
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}
</style>